home *** CD-ROM | disk | FTP | other *** search
- Path: es.rice.edu!joel
- From: joel@rice.edu (Joel Castellanos)
- Newsgroups: comp.lang.c++
- Subject: Q: Visual C++ rand
- Date: 4 Jan 1996 18:55:57 GMT
- Organization: Rice University, Houston, Texas
- Message-ID: <4ch7rt$aeu@larry.rice.edu>
- NNTP-Posting-Host: moe.rice.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- I am trying to use the rand function in Visual C++
- The help file says it is:
- int rand( void );
- Yet the following program gives me the compile error:
- error C2446: '=' : no conversion from 'int(__cdecl *)(void)' to 'int'
-
- rand should be returning an int - so why the conversion error?
-
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h>
- void main () {
- int n;
- n= rand;
- printf("n = %d\n", n);
- }
-